home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / human interface toolbox / fragment tool / fragmenttool.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-23  |  3.5 KB  |  217 lines

  1. /*
  2.     File:        FragmentTool.h
  3.  
  4.     Contains:    Common header file included by all source files
  5.  
  6.     Written by: Chris White    
  7.  
  8.     Copyright:    Copyright © 1995-1999 by Apple Computer, Inc., All Rights Reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.                 8/5/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  20.                 
  21.  
  22. */
  23.  
  24.  
  25. #ifndef __FRAGMENTTOOL__
  26. #define __FRAGMENTTOOL__
  27.  
  28.  
  29.  
  30. #ifndef __WINDOWS__
  31.     #include <Windows.h>
  32. #endif
  33.  
  34. #ifndef __FILES__
  35.     #include <Files.h>
  36. #endif
  37.  
  38. #include <Drag.h>
  39. #include <Lists.h>
  40. #include <Types.h>
  41. #include <Dialogs.h>
  42.  
  43.  
  44.  
  45.  
  46. #define DEBUGGING    1
  47.  
  48.  
  49. #define kFourQuestionMarks        0x3F3F3F3F        
  50.  
  51.  
  52. enum
  53. {
  54.     /* File types & creators */
  55.     
  56.     kCreatorCode = 'frgt'
  57. };
  58.  
  59.  
  60.  
  61. enum
  62. {
  63.     /* Internal error codes */
  64.     
  65.     kGenericError = 1,
  66.     kNeedSystem7,
  67.     kCFMNotPresent,
  68.     kMixedModeNotPresent,
  69.     kDragManagerNotPresent
  70. };
  71.  
  72.  
  73.  
  74. enum
  75. {
  76.     // Error strings
  77.     
  78.     
  79.     kGenericErrorStr = 4,
  80.     kUnresolvedDependenciesStr = 5,
  81.     kFileOpenStr = 6
  82. };
  83.  
  84.  
  85.  
  86. enum
  87. {
  88.     kDAWindowType = 100,
  89.     kDocumentWindowType,
  90.     kListWindowType,
  91.     kGetInfoWindowType,
  92.     kMoveFragmentWindowSubType,
  93.     kCopyFragmentWindowSubType
  94. };
  95.  
  96.  
  97.  
  98. enum
  99. {
  100.     kNotCancelled = false, 
  101.     kCancelled = true
  102. };
  103.  
  104. #define    kDisplayWindow    1000
  105.  
  106.  
  107.  
  108.  
  109. #define    kAboutDialog            1001
  110. #define    kErrorDialog            1002
  111. #define kSaveDontsaveDialog        2003
  112. #define rErrorStrings            1002
  113.  
  114. typedef    Byte        int8;    
  115. typedef    short        int16;
  116. typedef    long        int32;
  117.  
  118.  
  119.  
  120.  
  121. typedef struct WindowInfo
  122. {
  123.     Boolean        bUntitled;
  124.     Boolean        bDirty;
  125.     ListRef        listRef;
  126.     Handle        dataHandle;
  127.     FSSpec        fileSpec;
  128.     
  129. } tWindowInfo, *tWindowInfoPtr;
  130.  
  131.  
  132. typedef struct DialogInfo
  133. {
  134.     int16        windowType;
  135.     int16        windowSubType;
  136.     ListHandle    listRef;
  137.     int32        refCon;
  138.     
  139. } tDialogInfo, *tDialogInfoPtr;
  140.  
  141.  
  142.  
  143.  
  144. typedef struct DrawingWindow DrawingWindow, *DrawingWindowPeek;
  145.  
  146.  
  147.  
  148. typedef OSErr (*tContentsProcPtr) ( ListRef theList, void* refCon );
  149.  
  150.  
  151.  
  152.  
  153. struct AddFragmentsRecOut
  154. {
  155.     int16    theFileRef;
  156. };
  157.  
  158.  
  159. struct AddFragmentsRecIn
  160. {
  161.     Handle    theDataHandle;
  162. };
  163.  
  164.  
  165. typedef struct AddFragmentsRec
  166. {
  167.     union
  168.     {
  169.         struct AddFragmentsRecOut    out;
  170.         struct AddFragmentsRecIn    in;
  171.     } u;
  172.     
  173. } tAddFragmentsRec;
  174.  
  175.  
  176.  
  177. typedef struct DragData
  178. {
  179.     WindowRef    theWindow;
  180.     int16        theIndex;
  181. } tDragData;
  182.  
  183.  
  184.  
  185.  
  186. /* Global Variable Definitions */
  187.  
  188.  
  189.  
  190. /*
  191.    This allows me to include this file in all sources with the 
  192.    extern keyword used in all instances except the main source file.
  193. */
  194.  
  195. #ifdef __MAIN__
  196.     #define    global
  197. #else
  198.     #define    global    extern
  199. #endif
  200.  
  201.  
  202. global    Boolean                    gQuit;                  /* quit program flag */
  203. global    int32                    gSleepTime;
  204. global    int16                    gMenuState;                /* In what state did we last leave our menu bar? */
  205. global    WindowRef                gCurrentWindow;            /* Which window are we redrawing? */
  206. global    Handle                    gCommonMenuBar;            /* The menubar for the app itself, with no tool menus */
  207.  
  208. global    Boolean                    gHasDragManager;        /* Is the Drag Manager available? */
  209. global     UserItemUPP                gOutlineUserItemUPP;
  210. global    DragTrackingHandlerUPP    gDragTrackingHandlerUPP;
  211. global    DragReceiveHandlerUPP    gDragReceiveHandlerUPP;
  212. global    DragSendDataUPP            gDragSendDataProcUPP;
  213. global    ListClickLoopUPP        gClickLoopUPP;
  214.  
  215.  
  216. #endif    // __FRAGMENTTOOL__
  217.